package com.lyr.service;

import com.lyr.dao.UserRepository;
import com.lyr.entity.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author liyiruo
 * @Description
 * @Date 2024/8/19 下午4:08
 */
@Service
public class UserService {

    @Autowired
    private UserRepository userRepository;

    public void addUser(User user) {
        userRepository.save(user);
    }

    public User getUser(String id) {
        return userRepository.findById(id).orElse(null);
    }
}
